<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <style>
        .wrap{
            width: 100%;
            height: 1300px;
            position: relative;
        }
        .container{
            width: 50%;
            height: 200px;
            position: absolute;
            left: 0;
            top: 200px;
            z-index: 1;
            background-color: #dedede;
            overflow: scroll;
        }
        .box{
            width: 100px;
            height: 100px;
            position: absolute;
            left:0;
            top: 400px;
            background-color: deepskyblue;
        }
        .tip{
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 32px;
            z-index: 999;
            text-align: center;
            background: lightskyblue;
        }
        </style>
    </head>
    <body>
    <div class="wrap">
        <div class="tip"></div>
        <div class="container">
            <div class="box"></div>
        </div>
    </div>
    <script>
       let dom=document.querySelector(".box");
       let io=new IntersectionObserver(function(info){
           for(let i of info){
               console.log(i.intersectionRatio);
           }
       }); 
       io.observe(dom);
    </script>
    </body>
</html>